// 权限配置
import imgs from '@/img_path.json'
import { deepCopy } from '@/utils/tools'

class powerStatus implements commonInf.powerStatus {

    signInImsAllowed: boolean = false
    signInCSJMobAllowed: boolean = false
    exportOrderData: boolean = false
   
    newOrder: boolean = false
    editOrder: boolean = false
    postMq: boolean = false
    postReview: boolean = false
    reviewOrder: boolean = false
    postAutoReview: boolean = false
    paying: boolean = false
    setPaid: boolean = false
    makeSoftPrint: boolean = false
    makePrinting: boolean = false
    setArchived: boolean = false
    newAccount: boolean = false
    editAccount: boolean = false
    viewOrdersReport: boolean = false
    exportOrdersReport: boolean = false
    viewCommissionTable: boolean = false
    updateCommissionTable: boolean = false
    setMemberCommissionFactor: boolean = false
    uploadVICompanyReconciliations: boolean = false
    startReconciliationProcess: boolean = false
    editNews: boolean = false

    submitPay: boolean = false
    payPass: boolean = false
    alreadyPay: boolean = false

    // listOrdersByCompany: boolean = false
    // listOrdersOfDepartment: boolean = false
    // listAccountsByCompany: boolean = false
    // listAccountsByDepartment: boolean = false
    // listDepartment: boolean = false
    // listCompanies: boolean = false
   

    // 自定义标识
    crossCompany:boolean = false
    crossDepartment:boolean = false
    organizationManage:boolean = false
    auditingManage:boolean = false
     
}

const powerConf:commonInf.powerConf[] = [

    
    {
        label: '基础',
        mods: [
            {
                title: '登陆 IMS',
                key: 'signInImsAllowed',
                img: imgs.power,
            },
            {
                title: '登录 CSJMob',
                key: 'signInCSJMobAllowed',
                img: imgs.power,
            },
            {
                title: '跨公司管理',
                key: 'crossCompany',
                img: imgs.power
            },
            {
                title: '跨部门管理',
                key: 'crossDepartment',
                img: imgs.power
            }
        ]
    },
    {
        label: '车险',
        mods: [
           
           
            
            {
                title: '新增订单',
                key: 'newOrder',
                img: imgs.power,
            },
            {
                title: '编辑订单',
                key: 'editOrder',
                img: imgs.power,
            },
            {
                title: '申请计费',
                key: 'postMq',
                img: imgs.power,
            },
            {
                title: '申请核保',
                key: 'postReview',
                img: imgs.power,
            },
            {
                title: '申请支付',
                key: 'submitPay',
                img: imgs.power  
            },
            {
                title: '支付审核',
                key: 'payPass',
                img: imgs.power
            },
            {
                title: '支付确认',
                key: 'alreadyPay',
                img: imgs.power
            },
            {
                title: '核保',
                key: 'reviewOrder',
                img: imgs.power,
            },
           
            {
                title: '缴费',
                key: 'paying',
                img: imgs.power,
            },
            {
                title: '刷出金额',
                key: 'setPaid',
                img: imgs.power,
            },
            {
                title: '集印',
                key: 'makeSoftPrint',
                img: imgs.power,
            },
            {
                title: '打印',
                key: 'makePrinting',
                img: imgs.power,
            },
            {
                title: '转业务数据',
                key: 'setArchived',
                img: imgs.power,
            }
        ]
    },
    {
        label: '组织',
        mods: [
           
            {
                title: '组织管理',
                key: 'organizationManage',
                img: imgs.power
            },
            {
                title: '审核申请',
                key: 'auditingManage',
                img: imgs.power
            },
           
            
        ]
    },
    // {
    //     label: '财务',
    //     mods: [
    //         {
    //             title: '查看业务报表',
    //             key: 'viewOrdersReport',
    //             img: imgs.power,
    //         },
    //         {
    //             title: '导出业务报表',
    //             key: 'exportOrdersReport',
    //             img: imgs.power,
    //         },
    //         {
    //             title: '查看佣金表',
    //             key: 'viewCommissionTable',
    //             img: imgs.power,
    //         },
    //          {
    //             title: '更新佣金表',
    //             key: 'updateCommissionTable',
    //             img: imgs.power,
    //         },
    //         {
    //             title: '设置会员佣金系数',
    //             key: 'setMemberCommissionFactor',
    //             img: imgs.power,
    //         },
    //         {
    //             title: '上传对账用台账',
    //             key: 'uploadVICompanyReconciliations',
    //             img: imgs.power,
    //         },
    //         {
    //             title: '开始自动对账',
    //             key: 'startReconciliationProcess',
    //             img: imgs.power,
    //         },
            
    //     ]
    // },
    // {
    //     label: '其它',
    //     mods: [ 

    //         {
    //             title: '编辑官网新闻',
    //             key: 'editNews',
    //             img: imgs.power,
    //         },
    //         {
    //             title: '列出某分公司下属所有部门',
    //             key: 'listDepartment',
    //             img: imgs.power,
    //         },
    //         {
    //             title: '列出所有分公司',
    //             key: 'listCompanies',
    //             img: imgs.power,
    //         }

    //     ]
    // }

]


function buildReadonly (powerConf){

    let source = deepCopy(powerConf);

    source.forEach(item =>{

        item['mods'].forEach(mod =>{

            mod['disabled'] = true
            
        })
        
    })
    
    return source
}

// function 

const powerConfReadonly = buildReadonly(powerConf)

export {

    powerConf,
    powerConfReadonly,
    powerStatus,

}